package com.guigu.youxuan.mapper;

import com.guigu.youxuan.common.vo.OrderSearchVo;
import com.guigu.youxuan.pojo.OrderInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.guigu.youxuan.pojo.dto.OrderInfoDto;
import com.guigu.youxuan.pojo.dto.OrderByMidDto;
import com.guigu.youxuan.pojo.dto.OrderMerchantDto;
import com.guigu.youxuan.pojo.dto.SysUnpaidOrderDto;
import com.guigu.youxuan.pojo.dto.OrderDto;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author liweixin
 * @since 2024-05-15
 */
public interface OrderInfoMapper extends BaseMapper<OrderInfo> {
    /**
     * 根据供应商id查询和供应商对应的订单
     * @return
     */
    List<OrderInfo> list();


    /**
     * 商户管理的全部订单查询
     * @return
     */
    List<OrderMerchantDto> allMerchantHubListPage(@Param("sysUsersId")String sysUsersId,@Param("orderMerchantDto") OrderMerchantDto orderMerchantDto);

    /**
     * 商户管理的待收货订单查询
     * @param sysUsersId
     * @param orderMerchantDto
     * @return
     */
    List<OrderMerchantDto> pendingOrdersListPage(@Param("sysUsersId")String sysUsersId,@Param("orderMerchantDto") OrderMerchantDto orderMerchantDto);

    /**
     * 商户管理的待提货订单查询
     * @param sysUsersId
     * @param orderMerchantDto
     * @return
     */
    List<OrderMerchantDto> stayTakeOrdersListPage(@Param("sysUsersId")String sysUsersId,@Param("orderMerchantDto") OrderMerchantDto orderMerchantDto);

    /**
     * 商户管理的已提货订单查询
     * @param sysUsersId
     * @param orderMerchantDto
     * @return
     */
    List<OrderMerchantDto> alreadyTakeDeliveryOrdersListPage(@Param("sysUsersId")String sysUsersId,@Param("orderMerchantDto") OrderMerchantDto orderMerchantDto);

    //改进版vvvvv用户个人中心分页查询待支付订单信息
    List<OrderInfoDto> orderInfoListPage(String sysUsersId);
    List<OrderDto> getOrderList(@Param("vo") OrderSearchVo vo, @Param("date") String date,@Param("date1") String date1);

    List<OrderDto> getOrderList2(@Param("vo") OrderSearchVo vo);

    List<OrderDto> getOrderList(OrderSearchVo vo);

    /**
     * 用户个人中心分页查询待发货订单信息
     * @return
     */
    List<SysUnpaidOrderDto> awaitOrderListPage(String sysUsersId);

    /**
     * 用户个人中心分页查询待提货订单信息
     * @return
     */
    List<SysUnpaidOrderDto> awaitPickUpGoods(String sysUsersId);

    /**
     * 用户个人中心分页查询已提货订单信息
     * @return
     */
    List<SysUnpaidOrderDto> pickUpGoods(String sysUsersId);


    @Select(" SELECT * FROM order_info WHERE order_number = (SELECT MAX(order_number) FROM order_info)")
    OrderInfo getOrderNumber();
    List<OrderByMidDto> getOrderByMid2(@Param("vo") OrderSearchVo vo);

    List<OrderByMidDto> getOrderByMid(@Param("vo")OrderSearchVo vo, @Param("date") String date, @Param("date1")String date1);
}
